package com.wangsong.model;


import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;

public class UserValidator {
    @Length(min = 2, max = 8, message = "name长度需要在2和8之间", groups = {MUserGroups.MUserGroupsUpdate.class, MUserGroups.MUserGroupsAdd.class})
    private String name;

    @Max(value = 100, message = "age年龄不能大于100岁", groups = {MUserGroups.MUserGroupsUpdate.class, MUserGroups.MUserGroupsAdd.class})
    @Min(value = 18, message = "age必须年满18岁！", groups = {MUserGroups.MUserGroupsUpdate.class, MUserGroups.MUserGroupsAdd.class})
    private String age;

    @NotNull(message = "id就不能空", groups = {MUserGroups.MUserGroupsUpdate.class})
    @Null(message = "id就是空", groups = {MUserGroups.MUserGroupsAdd.class})
    @MUserIdError(message = "id错误", groups = {MUserGroups.MUserGroupsUpdate.class})
    private String id;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}
